package jmine.tec.web.wicket.converter;

import java.math.BigDecimal;
import java.util.Locale;

/**
 * Percentage converter
 * 
 * @author Rafael Volpato
 * @date Jun 18, 2010
 */
public class PercentageConverter extends BigDecimalConverter {

    /**
     * {@inheritDoc}
     */
    @Override
    public Object convertToObject(String value, Locale locale) {
        final BigDecimal bigDecimal = (BigDecimal) super.convertToObject(value, locale);
        return bigDecimal == null ? null : new PercentageBigDecimal(bigDecimal.toPlainString());
    }
}
